#include <QHBoxLayout>
#include <QList>
#include <QHostAddress>
#include <QHostInfo>
#include <QNetworkInterface>

#include "mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
    : QWidget(parent)
{
    setFixedSize(240, 240);
    setStyleSheet("background-color:#191970");

    mNetworkManager = new NetWorkManager(this);
    mPowerManager = new PowerManager(this);

    mainLayout = new QStackedLayout;

    mainLayout->addWidget(mNetworkManager);
    mainLayout->addWidget(mPowerManager);

    setLayout(mainLayout);

}

MainWindow::~MainWindow()
{
}

void MainWindow::keyPressEvent(QKeyEvent *event)
{
    if (event->key() == Qt::Key_C) {
        qDebug() << "Key : " << event->text();
        mainLayout->setCurrentIndex(0);
    } else if (event->key() == Qt::Key_D) {
        qDebug() << "Key : " << event->text();
        mainLayout->setCurrentIndex(1);
    }
}

